﻿using System.ComponentModel;

class CalculationEventArgs : EventArgs
{
    private int x, y, result;

    public CalculationEventArgs(int num1, int num2, int resultVal)
    {
        x = num1;
        y = num2;
        result = resultVal;
    }

    public int X
    {
        get { return x; }
    }

    public int Y
    {
        get { return y; }
    }

    public int Result
    {
        get { return result; }
    }
}

class Calculator
{
    public event EventHandler<CalculationEventArgs> CalculationPerformedEvent;

    public int CalculateProduct(int num1, int num2)
    {
        int result = num1 * num2;
        Console.WriteLine("Trigger Event : OnCalculationPerformed");

        OnCalculationPerformd(new CalculationEventArgs(num1, num2, result));
        return result;
    }

    private void OnCalculationPerformd(CalculationEventArgs Args)
    {
        EventHandler<CalculationEventArgs> handler = CalculationPerformedEvent;
        if (handler != null)
        {
            handler(handler, Args);
        }
    }
}

class Program
{
    static void Main(string[] args)
    {
        Calculator calc = new Calculator();
        calc.CalculationPerformedEvent += HandledEvent;

        calc.CalculateProduct(15, 225);

        Console.ReadKey();
    }

    private static void HandledEvent(object? sender, CalculationEventArgs e)
    {
        Console.WriteLine("Handle Event:");
        Console.WriteLine("Good Class: {0} * {1} = {2}", e.X, e.Y, e.Result);
    }
}